<div class="col-sm-12">
<h1>Jobs list</h1>

<div class="dropdown clearfix pull-right">
  <button class="btn btn-default dropdown-toggle" name="button" id="dropdownMenuDivider" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
    Sort
    <span class="caret"></span>
  </button>
  <ul class="dropdown-menu" aria-labelledby="dropdownMenuDivider">
    <li><%= link_to "Order by lower wage", jobs_path(:order => "by_lower_bound") %></li>
    <li><%= link_to "Order by upper wage", jobs_path(:order => "by_upper_bound") %></li>
    <li><%= link_to "Order by create date", jobs_path %></li>
  </ul>
</div>

<%= link_to "New", new_job_path, class: "btn btn-primary pull-right" %>


<table class="table">
  <thead>
    <tr>
      <th>#</th>
      <th>Title</th>
      <th>Description</th>
      <th>Wage</th>
      <th>Date</th>
      <th>Contact</th>
    </tr>
  </thead>
  <tbody>
    <% @jobs.each do |job| %>
    <tr>
      <td> # </td>
      <td> <%= job.title %> </td>
      <td> <%= job.description %> </td>
      <td> <%= "#{job.wage_lower_bound} - #{job.wage_upper_bound} " %> </td>
      <td> <%= job.created_at %> </td>
      <td> <%= job.contact_email %> </td>
      <td> <%= link_to "View", job_path(job), class: "btn btn-default pull-right" %></td>
      <td> <%= link_to "Edit", edit_job_path(job), class: "btn btn-default pull-right" %></td>
      <td> <%= link_to "Delete", job_path(job), method: :delete,
        data: {confirm: "are you sure?"} , class: "btn btn-default pull-right" %></td>
    </tr>
    <% end %>
  </tbody>
</table>
</div>
